package com.example.blog.mapper;

import com.example.blog.model.BlogInfo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface BlogInfoMapper {
//    int deleteById(Integer id);

    int insertBlog(BlogInfo record);

    BlogInfo selectById(Integer id);

    List<BlogInfo> selectAll();

    int updateBlog(BlogInfo record);

    BlogInfo selectByBookId(Integer id);

//    @Select("select count(1) from blog where user_id = #{userId}")
    Integer count(Integer userId);

    @Select("select id, title, user_id, delete_flag, create_time, update_time, content " +
            "from blog where delete_flag = 0 limit #{offSet}, #{limit}")
    List<BlogInfo> getListByPage(Integer limit, Integer offSet);
}